package service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import dao.CustomerDao;
import service.CustomerService;
import vo.Customer;
@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {
	@Resource
	private CustomerDao customerDao;
	
	@Transactional
	public void addCustomer(Customer customer) {
		customerDao.addCustomer(customer);
	}

	@Transactional
	public List<Object> search(String name, int start, int length) {
		List<Object> ret = (List<Object>)customerDao.searchByName(name, start, length);
		ret.add(0, customerDao.count(name));
		
		return ret;
	}
}
